﻿<?xml version="1.0" encoding="utf-8"?>
<FieldTypes>
  <FieldType>
    <Field Name="TypeName">Tag Field</Field>
    <Field Name="TypeDisplayName">Tag Field</Field>
    <Field Name="TypeShortDescription">Tag Field</Field>
    <Field Name="ParentType">Text</Field>
    <Field Name="UserCreatable">TRUE</Field>
    <Field Name="FieldTypeClass">5e5057f1-189c-473e-96c1-54b9ae55bdbd</Field>
    <PropertySchema>
      <Fields>
        <Field Name="Target" Type="Text" DisplayName="Pagina Target">
          <Default>/_layouts/OSSSearchResults.aspx?k=</Default>
        </Field>
        <Field Name="Separator" Type="Text" DisplayName="Carattere Separatore">
          <Default>,</Default>
        </Field>
      </Fields>
    </PropertySchema>
    <RenderPattern Name="DisplayPattern">
      <HTML><![CDATA[<div id="__Tags]]></HTML>
      <Column Name="ID" HTMLEncode="TRUE"/>
      <ListProperty Select='Name'/>
      <HTML><![CDATA["></div>]]></HTML>
      <HTML><![CDATA[<script>var tags = ']]></HTML>
      <Column HTMLEncode="TRUE"/>
      <HTML><![CDATA[';var splittedTags = tags.split(', ');]]></HTML>
      <HTML><![CDATA[for (var i = 0; i < splittedTags.length; i++){]]></HTML>
      <HTML><![CDATA[document.getElementById("__Tags]]></HTML>
      <Column Name="ID" HTMLEncode="TRUE"/>
      <ListProperty Select='Name'/>
      <HTML><![CDATA[").innerHTML+=']]></HTML>
      <HTML><![CDATA[<a href="]]></HTML>
      <HttpVDir/>
      <FieldSwitch>
        <Expr>
          <Property Select='Target'/>
        </Expr>
        <Case Value="">
          <HTML><![CDATA[/_layouts/OSSSearchResults.aspx?k=]]></HTML>
        </Case>
        <Default>
          <Property Select='Target'/>
        </Default>
      </FieldSwitch>
      <HTML><![CDATA[' + splittedTags[i] + '">' + splittedTags[i] + '</a>&nbsp;';}</script>]]></HTML>
    </RenderPattern>
  </FieldType>
</FieldTypes>